package com.spzx.product.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.product.api.domain.Category;
import com.spzx.product.api.factory.RemoteCategoryServiceFactory;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

@FeignClient(contextId = "remoteCategoryService",
value = ServiceNameConstants.PRODUCT_SERVICE ,
fallbackFactory = RemoteCategoryServiceFactory.class)
public interface RemoteCategoryService {
    @Operation(summary = "内部调用接口：获取首页分类集合")
    @GetMapping("category/listIndexCates")
    public R<List<Category>> listIndexCates();
//    public R<List<Category>> listIndexCates(@RequestHeader(value = SecurityConstants.FROM_SOURCE)
//                                            String inner);
    //调用listIndexCates("inner")==> 请求报文头中会添加 from-source->inner

    @Operation(summary = "内部调用接口：获取分类页分类嵌套集合")
    @GetMapping("category/listCateTree")
    public R<List<Category>> listCateTree();
}
